import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.mixin({
  mounted () {
    if (typeof this.$el.className === 'string') {
      if (this.$el.className.split(' ').indexOf('el-select') !== -1) {
        if (!this.$el.children[0] || !this.$el.children[0].children[0]) {
          return false
        }
//找到input
        this.$el.children[0].children[0].removeAttribute('readOnly')
        this.$el.children[0].children[0].onblur = function () {
          let _this = this
          setTimeout(() => {
            _this.removeAttribute('readOnly')
          }, 200)
        }
      }
    }
  }
})
Vue.use(ElementUI);

import App from './App'
import router from './router'

Vue.prototype.IP_URL = process.env.IP_URL

axios.interceptors.request.use(function (config) {
    //拿一下token
    const token = localStorage.getItem('token')
    if(token){
      config.headers.Authorization = 'Bearer ' + token
    }
    return config;
}, function (error) {
    return Promise.reject(error);
});

Vue.config.productionTip = false

new Vue({
	el: '#app',
	router,
	components: {
		App
	},
	template: '<App/>'
})
